<?php

namespace App\Models\CarModels;

use App\Models\SystemManagement\Employee;
use Illuminate\Database\Eloquent\Model;

class CarRepairRecord extends Model
{

    //
    protected $table = 'car_repair_records';
    protected $fillable = ['repair_time','reason','detail','mileage','amount','desc','car_id','record_id','address','department','department_id'];
    public function cars(){
        return $this->belongsTo(CarInfo::class,'car_id','id')->with('kind');
    }
    public function car(){
        return $this->belongsTo(CarInfo::class,'car_id','id')->with('kind');
    }

    public function record(){
        return $this->belongsTo(Employee::class,'record_id','id');
    }

    function detail(){
        return $this->hasMany(CarRepairRecordDetail::class,'record_id','id')->with('files');
    }
}
